<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>contributor-guide: VP8 Contributors Guide | Webm Project</title>
<style type="text/css">
body {
  color: #000;
  background-color: #fff;
  margin: 10% 30% 10% 10%;
  font-family: "Liberation Sans", "DejaVu Sans", "Bitstream Vera Sans", Arial, sans-serif;
  line-height: 1.4;
}
h2 {
  border-bottom: 1px solid #ccc;
  padding-bottom: 0;
}
table {
  border-collapse: collapse;
}
th, td {
  border: 1px solid #999;
  padding: .5em .7em;;
}
th {
  color: #fff;
  background-color: #000;
}
td {
}
hr {
}
pre {
  background-color: #eee;
  padding: 1em;
  border: 1px solid #ccc;
  /*width: 42em;*/
  overflow: auto;
  font-family: "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Consolata, monospace;
}
pre.terminal {
  color: #fff;
  background-color: #000;
  border: 1px solid #ccc;
  max-height: 30em;
}
code {
  color: #060;
  background-color: #eee;
  padding: 0 3px;
  font-family: "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Consolata, monospace;
}
pre code {
  padding: 0;
}
pre.terminal code {
  color: #fff;
  background-color: #000;
  font-size: smaller;
}
#markdown-toc ul {
  list-style-type: disc;
}
ul#markdown-toc {
  margin-top: -1em;
  visibility: hidden;
  -webkit-padding-start: 0;
}
ul#markdown-toc ul {
  visibility: visible;
}
ul#markdown-toc ul ul{
  visibility: visible;
}
ul#markdown-toc + hr {
  margin-bottom: 3em;
}
.caption {
}
/* Admonitions, DocBook style
* Icons provided by the Tango Desktop Project, http://tango.freedesktop.org/
*/
div.admon {
  background-position: 10px 14px;
  background-repeat: no-repeat;
  padding: 1em;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
  border: 1px solid #ccc;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  /*width: 42em;*/
}
div.admon a, div.admon a:visited { }
div.admon a:hover, div.admon a:active { }
div.admon p {
  padding: 0;
  margin: 0;
  padding-left: 48px;
}
div.note {
  background-color: #ffc;
  background-image: url()
}
div.note code {
  background-color: #eeb;
}
div.tip {
  background-color: #eee;
  background-image: url()
}
div.tip p:first-child {
  font-weight: bold;
  margin-bottom: .5em;
}
div.tip code {
  background-color: #ddd;
}
div.caution { /* Shares "warning" icon */
  background-color: #ffc;
  background-image: url(images/tango-icons/warning.png)
}
div.warning {
  background-color: #ffc;
  background-image: url(images/tango-icons/warning.png)
}
div.important {
  background-color: #f7f7f7;
  background-image: url()
}
</style>
</head>
<body>

<h1 id="contributing-source-code-to-libvpx">Contributing Source Code to libvpx</h1>

<p><em>Revised 2011-01-05</em></p>

<p>This document will help guide you through contributing code to the WebM
Project and libvpx.</p>

<hr />

<p><strong>Contents</strong></p>

<ul id="markdown-toc">
  <li><a href="#contributing-source-code-to-libvpx">Contributing Source Code to libvpx</a>    <ul>
      <li><a href="#required-packages">Required Packages</a></li>
      <li><a href="#become-a-contributor">Become a Contributor</a></li>
      <li><a href="#subscribe-to-codec-devel">Subscribe to codec-devel</a></li>
      <li><a href="#download-test-clips">Download Test Clips</a></li>
      <li><a href="#download-test-scripts">Download Test Scripts</a></li>
      <li><a href="#download-build-and-test-libvpx">Download, Build and Test libvpx</a></li>
      <li><a href="#submit-your-patches">Submit Your Patches</a></li>
    </ul>
  </li>
</ul>

<hr />

<p>In general, most of the on-going work on libvpx concerns speed and
quality improvement. A developer typically follows this workflow:</p>

<ol>
  <li>Work on the source code.</li>
  <li>Recompile the <code>vpxenc</code> encoder binary.</li>
  <li>Perform a video encode job with the new binary.</li>
  <li>Evaluate the results, comparing to an identical encode done with a
prior version of <code>vpxenc</code>.</li>
</ol>

<p>Once meaningful improvement is achieved, the developer submits his code
revisions to <code>libvpx</code>.</p>

<p>Below we describe in more detail how the core libvpx developers
evaluate their own work, so that new contributors can replicate the
process and have their code contributions approved and merged more
easily.</p>

<h2 id="required-packages">Required Packages</h2>

<ul>
  <li>A Bash shell</li>
  <li>Python</li>
  <li>A modern web browser (like Google Chrome)</li>
</ul>

<h2 id="become-a-contributor">Become a Contributor</h2>

<p>All contributors are welcome. The WebM Project website has details on
configuring your machine and creating an account in our code review
system, so review the information at
<strong><a href="http://www.webmproject.org/code/">http://www.webmproject.org/code/</a></strong> to get started.</p>

<h2 id="subscribe-to-codec-devel">Subscribe to codec-devel</h2>

<p><strong><em>codec-devel</em></strong> is the mailing list (and Google Group) for developers
working on the libvpx library or researching next generation codecs.
While anyone may post to codec-devel, subscribing gives you unmoderated
access.</p>

<ul>
  <li>Archive: <a href="https://groups.google.com/a/webmproject.org/group/codec-devel">https://groups.google.com/a/webmproject.org/group/codec-devel</a></li>
  <li>Subscribe: &lt;codec-devel+subscribe@webmproject.org&gt;</li>
  <li>Post: <a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#099;&#111;&#100;&#101;&#099;&#045;&#100;&#101;&#118;&#101;&#108;&#064;&#119;&#101;&#098;&#109;&#112;&#114;&#111;&#106;&#101;&#099;&#116;&#046;&#111;&#114;&#103;">&#099;&#111;&#100;&#101;&#099;&#045;&#100;&#101;&#118;&#101;&#108;&#064;&#119;&#101;&#098;&#109;&#112;&#114;&#111;&#106;&#101;&#099;&#116;&#046;&#111;&#114;&#103;</a></li>
</ul>

<p>Though <em>codec-devel</em> offers a web interface, many subscribers treat it
as a simple mailing list and interact solely through their mail clients.</p>

<h2 id="download-test-clips">Download Test Clips</h2>

<ol>
  <li>Create a directory to hold the clips (e.g., <code>~/derf_cif</code> on Linux
or <code>c:/derf_cif</code> on Windows).</li>
  <li>Visit <a href="http://media.xiph.org/video/derf/">http://media.xiph.org/video/derf/</a> with your web browser.</li>
  <li>Download each of the the CIF clips found there, in YUV4MPEG (y4m)
format, to the directory you created.</li>
</ol>

<div class="admon tip">
  <p>Encoding Only a Few Test Clips</p>

  <p>Normally, you won&rsquo;t want to encode the entire set of test clips, which
can be very time-consuming. Instead, consider symlinking only the clips
you want to use from their storage directory (e.g. <code>~/derf_cif</code>) to a
working directory (e.g. <code>~/derf_working</code>), and running your tests there.</p>
</div>

<h2 id="download-test-scripts">Download Test Scripts</h2>

<p>Test scripts (and this document) are available in the
<code>contributor-guide</code> Git project:</p>

<pre><code>$ git clone http://git.chromium.org/webm/contributor-guide.git
$ cd contributor-guide
</code></pre>

<p>Symlink or physically copy the following scripts to somewhere in your
$PATH:</p>

<ul>
  <li><code>be</code></li>
  <li><code>run_tests</code></li>
  <li><code>visual_metrics.py</code></li>
</ul>

<h2 id="download-build-and-test-libvpx">Download, Build and Test libvpx</h2>

<ol>
  <li>
    <p>To get started, ensure that your system satisfies the <strong><a href="http://www.webmproject.org/code/build-prerequisites/">build
prerequisites</a></strong>.</p>
  </li>
  <li>
    <p>Next, <strong>clone the libvpx repository</strong>. After cloning, you&rsquo;ll be
working in the master branch by default.</p>

    <pre><code>$ git clone http://git.chromium.org/webm/libvpx.git
$ cd libvpx
</code></pre>

    <div class="admon important">
      <p><strong>Important:</strong>  Although its not the common case, if your idea
would necessitate a change to the VP8 format itself, you&rsquo;ll want
to work in the libvpx experimental branch instead:</p>

      <pre><code>$ git clone http://git.chromium.org/webm/libvpx.git
$ cd libvpx
$ git checkout -b experimental origin/experimental
</code></pre>
    </div>
  </li>
  <li>
    <p><strong>Configure and build libvpx.</strong> Be sure to run the configure
script with <code>--enable-internal-stats</code>, which causes the encoder
(<code>vpxenc</code>) to output statistical data as well as a video file. For
example:</p>

    <pre><code>$ ./configure --disable-codecs --enable-vp8 --enable-internal-stats --enable-debug --disable-install-docs --log=yes
$ make
</code></pre>

    <p>To learn more about configuration options, do:</p>

    <pre><code>$ ./configure --help
</code></pre>

    <p>There are several ways to &ldquo;install&rdquo; (<code>make install</code>, etc.), so
we&rsquo;ll leave that up to you.  Just ensure that the VP8 encoder
(<code>vpxenc</code>) is executable and in your $PATH.</p>
  </li>
  <li>
    <p><strong>Run some encodes</strong> using the provided scripts.  Example:</p>

    <pre><code>$ cd &lt;test clip directory&gt;
$ run_tests 200 500 50 baseline
</code></pre>

    <p>In this example, <code>run_tests</code> will encode each <code>y4m</code> file in the
current directory at bitrates of 200, 250, 300, 350, 400, 450 and
500 kbps (start at 200, end at 500, 50 kbps increments). It will
create a directory <code>baseline</code> and write its output there.</p>

    <p>Output consists of <code>webm</code> video files and <code>stt</code> files containing
statistics for each encode. If the test encodes are 2-pass
(default), an <code>fpf</code> file (first-pass data file) is also written
for each input file, and will be reused on subsequent 2-pass
encodes if not deleted.</p>
  </li>
  <li>
    <p><strong>Make your changes to libvpx</strong>, rebuild, and re-run the tests
using a different output directory name. Example:</p>

    <pre><code>$ run_tests 200 500 50 mytweak
</code></pre>

    <p>Alternatively, change the parameters in the batch encoder script
(<code>be</code>) that&rsquo;s called by <code>run_tests</code>. <code>be</code> in turn calls <code>vpxenc</code>.</p>
  </li>
  <li>
    <p>When the tests are finished, run <code>visual_metrics.py</code> to generate
an <strong>HTML-format report</strong> that compares <code>mytweak</code> with <code>baseline</code>.</p>

    <pre><code>$ visual_metrics.py "*stt" baseline mytweak &gt; mytweak.html
</code></pre>
  </li>
  <li>
    <p><strong>View the report</strong> by opening <code>mytweak.html</code> in a web browser.</p>
  </li>
</ol>

<h2 id="submit-your-patches">Submit Your Patches</h2>

<p>See the detailed information at <strong><a href="http://www.webmproject.org/code/contribute/submitting-patches/">http://www.webmproject.org/code/contribute/submitting-patches/</a></strong>.</p>

<!--
Icon artwork courtesy of the Tango Desktop Project,
http://tango.freedesktop.org/
-->

</body>
</html>
